﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace EFDataModel
{
    public partial class DynamicDataTypeCategory : IComparable<DynamicDataTypeCategory>
    {
        #region static
        #endregion

        #region Private Functions
        /// <summary>
        /// Compares the current object with another object of the same type.
        /// </summary>
        /// <returns>
        /// A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the <paramref name="other"/> parameter.Zero This object is equal to <paramref name="other"/>. Greater than zero This object is greater than <paramref name="other"/>. 
        /// </returns>
        /// <param name="other">An object to compare with this object.</param>
        public int CompareTo(DynamicDataTypeCategory other)
        {
            //Wenn eine SortID angegeben ist für beide Versionen, dann wird die Anzeige nach der SortId ausgelegt
            if (this.SortId.HasValue && other.SortId.HasValue)
            {
                return string.Compare(this.SortId.Value.ToString(), other.SortId.Value.ToString());

            }

            //Sonst wird nach dem Namen sortiert.
            return string.Compare(this.Name, other.Name);
        }
        #endregion
    }
}
